package com.cy.stone.framework.dami;

import com.cy.stone.system.infrastructure.database.entity.OperLogEntity;
import com.cy.stone.system.infrastructure.database.service.IOperLogService;
import lombok.RequiredArgsConstructor;
import org.noear.dami.spring.boot.annotation.DamiTopic;

import java.util.concurrent.CompletableFuture;

/**
 * 操作记录日志事件实现
 * @author Wings
 * @since 2023-12-15
 */
@DamiTopic(DamiTopicConstant.OPERLOG_EVENT)
@RequiredArgsConstructor
public class OperLogEventListener {

    private final IOperLogService operLogService;

    public void operLog(OperLogEntity operLogEntity) {
        CompletableFuture.runAsync(() -> {
            operLogService.save(operLogEntity);
        });
    }
}
